#!/usr/bin/env bash
set -euo pipefail

# 基础架构风格巡检（占位版）
# 读取 config/rules.env，输出当前风格并进行轻量提示。

ROOT_DIR="$(cd "$(dirname "$0")"/.. && pwd)"
ENV_FILE="$ROOT_DIR/config/rules.env"

if [[ ! -f "$ENV_FILE" ]]; then
  echo "Config not found: $ENV_FILE" >&2
  exit 1
fi

# shellcheck disable=SC1090
source "$ENV_FILE" >/dev/null 2>&1 || true

style="${ARCHITECTURE_STYLE:-unset}"
echo "Architecture style: $style"

case "$style" in
  ddd)
    echo "Expect layering: Controller → Facade → AppService → Domain/Repo"
    ;;
  three_tier)
    echo "Expect layering: Controller → Service → Repository"
    ;;
  *)
    echo "Unknown style. Set ARCHITECTURE_STYLE=ddd|three_tier in config/rules.env"
    exit 2
    ;;
esac

echo "(stub) Add concrete checks here (ripgrep naming, package layout, annotations)."
